/**
 * @ClassName LC105 从前序与中序遍历序列构造二叉树
 * @Author ykx
 * @Date 2024/3/24 23:33
 * @Version 1.0
 */
public class LC105 {
    public TreeNode buildTree(int[] preorder, int[] inorder) {
        if (preorder.length == inorder.length && preorder.length == 1) {
            return new TreeNode(preorder[0]);
        }
        int index = 0;
        while (inorder[index] != preorder[0]) {
            index++;
        }
        // inorder[index]中序遍历的index位置为根节点
        // ，0-(index-1)为左子树，(index+1)-(inorder.length-1)为右子树

        return null;
    }
}
